package com.youjia.center.boot.data.mp.basic.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.util.Map;

/**
 * queryMap转换为queryWrapper
 * @author fengjiansong
 * @date 2022/5/22 9:21 上午
 */
class Map2WrapperHelper {

    static <ENTITY> QueryWrapper<ENTITY> map2Wrapper(Map<String, Object> queryMap,Class<ENTITY> entityClass){

        QueryWrapper<ENTITY> queryWrapper =new QueryWrapper<>();

        var entrySet = queryMap.entrySet();

        entrySet.forEach(p->{
            queryWrapper.eq(p.getKey(), p);
        });

        return queryWrapper;
    }

}
